package com.example.factory.core.repository;

import com.example.factory.core.domain.FactoryEntity;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Lei Tao
 */
@Repository
public interface FactoryRepository extends CrudRepository<FactoryEntity,Long> {
    FactoryEntity findByGuid(String guid);

    @Query("select count(f.id) from FactoryEntity f")
    long selectAllCount();

    @Query("select f from FactoryEntity f")
    List<FactoryEntity> selectFactories();
}
